package com.boot.dongli.dlxAuto;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author: lkz
 * @Title: AutoProMsg
 * @Description: 手动确认消息，发生一场拒绝重新进去队列 从而进入私信队列
 * @Date: 2023/10/16 16:28
 */
@Component
@Slf4j
public class AutoProMsg {


    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendMsg() {
//        MessageProperties messageProperties=new MessageProperties();
//        messageProperties.setPriority(6); // 测试队列等级
        String str="hello world";
        Message message = MessageBuilder.withBody(str.getBytes())
                .build();
        rabbitTemplate.convertAndSend("auto.normal.exchange", "auto.normal", message);

        log.info("消息发送完毕：发送时间为：{}", new Date());
    }

}
